package com.xal.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * @program: mybatisplus
 * @author: 邢奥林
 * @create: 2023-04-12 14:29
 **/
@Configuration
@EnableSwagger2//开启swagger注解驱动
public class SwaggerConfig {
    @Bean
    public Docket docket(){
        Docket docket = new Docket(DocumentationType.SWAGGER_2).groupName("Qy163")
                .apiInfo(getinfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.xal.controller"))//只为com.xal.conttroller包下的类生成接口文档
                .build();
        return docket;
    }

    public ApiInfo getinfo(){
        Contact DEFAULT_CONTACT = new Contact("王桑", "http://www.baidu.com", "120@qq.com");
        ApiInfo apiInfo = new ApiInfo("铜锣湾项目API", "铜锣湾项目API", "1.1.0", "http://www.jd.com",
                DEFAULT_CONTACT, "志远科技", "http://www.aaa.com", new ArrayList<VendorExtension>());
        return apiInfo;
    }
}
